import 'package:flutter/cupertino.dart';

import '../image/public_image.dart';

class SmallLoading extends StatefulWidget {
  // 私钥
  late double width;
  late double height;

  SmallLoading({
    super.key,
    required this.width,
    required this.height,
  });

  @override
  _SmallLoadingState createState() => _SmallLoadingState();
}

class _SmallLoadingState extends State<SmallLoading>  with TickerProviderStateMixin {

  late AnimationController _controller;
  late AnimationController _animationController;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(
      duration: const Duration(milliseconds: 5000),
      vsync: this,
    );

    if (mounted) _animationController.forward();
    _controller = AnimationController(
      duration: const Duration(seconds: 2),
      vsync: this,
    )..repeat();
  }

  @override
  void dispose() {
    _controller.dispose();
    _animationController.dispose();
    // TODO: implement dispose
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      height: widget.height,
      width: widget.width,
      child: RotationTransition(
        turns: Tween(begin: 0.0, end: 1.0).animate(_controller),
        child: PublicImage(
          image: 'assets/images/create_wallet/loading.png',
          height: widget.height,
          width: widget.width,
        ), // 需要旋转的组件
      ),
    );
  }



}
